<template>
	<el-select v-model="model" multiple filterable v-bind="$attrs" @change="handleChange">
        <el-option 
            v-for="(item, index) in items" 
            :key="index" 
            :value="item.id" 
            :label="item.mc"
        />
    </el-select>
</template>
<script setup lang="ts" name="questionBankMultSelect">
import { onMounted, ref} from 'vue';
import request from '/@/utils/request';

const emits = defineEmits(['change']);
const model = defineModel();

const items = ref([] as any[]);
const loading = ref(false);

const loadData = ()=>{
    loading.value = true;
    request.get('/training/exam/questionBank/list', {
		params: {
			ztList: [20],
			total: 0,
            pageNum: 1,
            pageSize: 999,
		}
	}).then(res => {
        items.value = res?.data?.list || [];
    }).finally(()=>{
        loading.value = false
    })
}

onMounted(()=>{
    loadData();
})

const handleChange = (data:any)=>{
    emits("change", data);
}

</script>